package cn.claim.storage.tools;

public final class JSONTransportingData implements TransportingData, JSONParsable {
    private final String md5;
    private final long range;

    public JSONTransportingData(String md5, long range) {
        this.md5 = md5;
        this.range = range;
    }

    /**
     * <em>Do not call this constructor!</em>
     * Just for {@code Class.newInstance()}
     */
    @Deprecated
    public JSONTransportingData() {
        md5 = null;
        range = 0;
    }

    @Override
    public String getSuffix() {
        return ".jsonLog";
    }

    @Override
    public TransportingData getInstance(String md5, long range) {
        return new JSONTransportingData(md5, range);
    }

    @Override
    public String getMd5() {
        return md5;
    }

    @Override
    public long getRange() {
        return range;
    }

    @Override
    public String toString() {
        return this.toJSON();
    }
}
